package com.andova.toolkit.net;

import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * @deprecated Use {@link com.andova.net.upload.UploadBean} instead.
 */
public class UploadBean implements Parcelable {
    /**
     * 标志是否已上传成功
     */
    public boolean updated;
    /**
     * 需上传的图片的Bitmap格式
     */
    public Bitmap bitmap;
    /**
     * 需上传的文件路径
     */
    public String url;
    public String id;

    public UploadBean() {
    }

    public UploadBean(Bitmap bitmap) {
        this(bitmap, "");
    }

    public UploadBean(Bitmap bitmap, String id) {
        url = "";
        updated = false;
        this.id = id;
        this.bitmap = bitmap;
    }

    public static final Creator<UploadBean> CREATOR = new Creator<UploadBean>() {
        @Override
        public UploadBean createFromParcel(Parcel in) {
            UploadBean bean = new UploadBean();
            bean.updated = in.readByte() != 0;
            bean.bitmap = in.readParcelable(Bitmap.class.getClassLoader());
            bean.url = in.readString();
            bean.id = in.readString();
            return bean;
        }

        @Override
        public UploadBean[] newArray(int size) {
            return new UploadBean[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeByte((byte) (updated ? 1 : 0));
        parcel.writeParcelable(bitmap, i);
        parcel.writeString(url);
        parcel.writeString(id);
    }
}